package models;

import javax.persistence.Entity;

import play.data.validation.Required;

@Entity
public class Drink extends Product {
	
	@Required
	public int calories;
	
	@Required
	public double price;

	@Override
	public int getCalories() {
		return this.calories;
	}

	@Override
	public double getPrice() {
		return this.price;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + calories;
		long temp;
		temp = Double.doubleToLongBits(price);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (!(obj instanceof Drink))
			return false;
		Drink other = (Drink) obj;
		if (calories != other.calories)
			return false;
		if (Double.doubleToLongBits(price) != Double
				.doubleToLongBits(other.price))
			return false;
		return true;
	}

}
